package com.dzh.healthflutter;

import androidx.appcompat.app.AppCompatActivity;

import android.content.Intent;
import android.os.Bundle;
import android.view.View;

import com.dzh.healthflutter.flutter.FlutterDzhViewActivity;
import com.dzh.healthflutter.flutter.FlutterFragmentActivity;
import com.dzh.healthflutter.flutter.FlutterLoadSoActivity;
import com.dzh.healthflutter.flutter.FlutterPageActivity;
import com.dzh.healthflutter.flutter.FlutterViewActivity;

import io.flutter.embedding.android.FlutterActivity;

public class MainActivity extends AppCompatActivity {


    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);


        findViewById(R.id.tvFlutterAddView).setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                  //原生添加view
                  startActivity(new Intent(MainActivity.this, FlutterViewActivity.class));
            }
        });
        findViewById(R.id.tvFlutterDzhView).setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                 //原生添加view
                  startActivity(new Intent(MainActivity.this, FlutterDzhViewActivity.class));
            }
        });
        findViewById(R.id.tvFlutterPage).setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                  //打开flutter页面
//                  startActivity(new Intent(MainActivity.this, FlutterPageActivity.class));
                  startActivity(FlutterActivity.withNewEngine().initialRoute("/").build(MainActivity.this));
            }
        });
        findViewById(R.id.tvFlutterFragment).setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                  //打开flutter页面
                  startActivity(new Intent(MainActivity.this, FlutterFragmentActivity.class));
            }
        });
        findViewById(R.id.tvFlutterLoadSo).setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                  //打开flutter页面
                  startActivity(new Intent(MainActivity.this, FlutterLoadSoActivity.class));
            }
        });
    }
}
